package com.neusoft.lohas.common.utils;

public class RmiCheckCode {

	public static String getcode() {

		char[] code = new char[4];

		for (int i = 0; i < 4; i++)
		{
			code[i] = NUM_ARRAY[randomIndex()];
		}
		return new String(code);
		// return new String("1234");

	}

	private static final char[] NUM_ARRAY = { '0', '1', '2', '3', '4', '5',
			'6', '7', '8', '9' };

	private static int randomIndex() {
		int num = -1;
		while (true) {
			num = (int) Math.round(Math.random() * 100);
			if (num >= 0 && num < NUM_ARRAY.length)
				break;
		}
		return num;
	}
}
